home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
4dostool
/
mav120.zip
/
MAV.BTM
< prev
Wrap
Text File
|
1992-10-29
|
12KB
|
357 lines
@echo off
setlocal
unalias *
goto env_space
: ┌───────────────────── Information ──────────────────────┐
: │ │
: │ This is Mally's Archive Viewer. The purpose of this │
: │ program is to facilitate viewing the contents of a │
: │ so called archive without having to remember the │
: │ parameters and without having to clean up the mess │
: │ after you finish. │
: │ │
: │ This is a Batch To Memory (btm) file, │
: │ which means that it is a very fast batch file that │
: │ will only run if 4DOS is your command interpreter. │
: │ Moreover, it is assumed that you use 4DOS version │
: │ 4.0 or later. 4DOS is a shareware program, available │
: │ at almost every BBS and `anonymous FTP' site. │
: │ │
: │ Of course, you are free to make as many changes in │
: │ this program as you like. If you do, please change │
: │ the name of the file and remove my name (%MYNAME). │
: │ │
: │ If you have any remarks, questions or suggestions, │
: │ E-mail me at │
: │ MALLY@eco.rug.nl │
: │ │
: └────────────────────────────────────────────────────────┘
:installation
: ┌───────────────────── Installation ─────────────────────┐
: │ │
: │ Fill in the path to your archivers, e.g. │
set ARCPATH=y:;g:\utils\zip;g:\utils\arj
: │ (Only needed if not already in path) │
: │ │
: │ Fill in the archive extensions known to your system │
: │ ( any of [arc,arj,lzh,zip,zoo] ), e.g. │
set ARCTYPES=arc;arj;lzh;zip;zoo
: │ MAV uses the following programs to handle archives: │
: │ arc : PKUNPAK (PKWARE Inc.) │
: │ arj : ARJ (Robert K. Jung) │
: │ lzh : LHA (Haruyasu Yoshizaki) │
: │ zip : PKUNZIP (PKWARE Inc.) │
: │ zoo : ZOO (Rahul Dhesi) │
: │ │
: │ Fill in the working directory, i.e. the directory │
: │ where some temporary files will be written │
set WORKINGDIR=g:\mav
: │ │
: │ Define the parameter DOCU, i.e. indicate the │
: │ files to `show only' if this parameter is used │
set DOCU=*.doc *.txt *.me *.man *.bat *.btm
: │ │
: │ Colors used in selection windows are set by the │
: │ HistWinColor directive in 4DOS.INI. │
: │ │
: └────────────────────────────────────────────────────────┘
: ┌────────────────────── History ─────────────────────────┐
: │ │
: │ v1.2 Changed name to MAV. │
: │ Minimized amount of free environment space │
: │ needed at start-up. │
: │ Check on existence of WORKINGDIR added. │
: │ Can now handle full pathnames in ZIP files. │
: │ Parameter DOCU added. │
: │ v1.1 Several improvements. Donated to the │
: │ public domain. │
: │ v1.02 Changed listing technique of archives │
: │ (much faster) │
: │ v1.01 Minor alterations and bug fixes │
: │ v1.00 First release for very small public │
: │ │
: └────────────────────────────────────────────────────────┘
goto continue
:env_space
: This is a trick to assure enough environment space under almost all
: circumstances. MAV needs 20 bytes of environment space to start but
: approximately 512 bytes to run. If not enough space is available,
: MAV reloads itself in a secondary shell.
: Under exceptional circumstances it is possible that 512 bytes are not
: enough to run. The solution is to increase the value of ES, set below.
if %_env LT 20 goto error_memory
set ES=512 >& nul
if "%1"=="/run" goto installation
if %_env GE %ES goto installation
%COMSPEC //EnvFree=%ES /c %0 /run %& >&> nul
goto end
:continue
set VERSION=v1.2
set MYNAME=Mally
iff "%1"=="/run" then
if %#==1 goto syntax
shift 1
else
if %#==0 goto syntax
endiff
if "%_4ver"=="" set _4ver=0
iff %_4ver LT 4.0 then
echo.
echo Sorry, need 4DOS version 4.0 or higher to run.
goto end
endiff
keystack !
if "%ARCPATH" NE "" path %ARCPATH%;%PATH%
set ARCHIVE=%1
iff %@eval[%@index[%ARCHIVE,.]+1]==%@len[%ARCHIVE] then
set ARCHIVE=%@substr[%ARCHIVE,0,%@index[%ARCHIVE,.]]*.*
endiff
set SHOWONLY=%2&
if "%@upper[%SHOWONLY]"=="DOCU" set SHOWONLY=%DOCU
if "%@substr[%WORKINGDIR,0,-1]" NE "\" set WORKINGDIR=%WORKINGDIR%\
iff NOT isdir %WORKINGDIR then
echo.
echo The working directory %@upper[%WORKINGDIR] does not exist.
inkey /K"YyNn" Should it be created? (y/n) %%CHAR
iff "%@upper[%CHAR]"=="N" then
echo Directory NOT created.
shift -1
echo See file %@upper[%@search[%0]] for installation directives.
quit
endiff
md %WORKINGDIR
endiff
set LIST=%@unique[%WORKINGDIR]
set LISTING=%@unique[%WORKINGDIR]
set DELFILES=%LIST %LISTING
pushd
cdd %@path[%ARCHIVE] >& NUL
set ARCDIR=%_cwds
set ARCHIVE=%@name[%ARCHIVE]%.%@ext[%ARCHIVE]
if "%@ext[%ARCHIVE]"=="*" set ARCHIVE=%@name[%ARCHIVE]
iff "%@ext[%ARCHIVE]"=="" then
if %@index[%ARCTYPES%,arc] GE 0 set ATYPES=%ARCHIVE%.arc;
if %@index[%ARCTYPES%,arj] GE 0 set ATYPES=%ATYPES%%ARCHIVE%.arj;
if %@index[%ARCTYPES%,lzh] GE 0 set ATYPES=%ATYPES%%ARCHIVE%.lzh;
if %@index[%ARCTYPES%,zip] GE 0 set ATYPES=%ATYPES%%ARCHIVE%.zip;
if %@index[%ARCTYPES%,zoo] GE 0 set ATYPES=%ATYPES%%ARCHIVE%.zoo;
set ARCTYPES=%ATYPES%
set ATYPES=
dir %ARCTYPES /bfOn > %LISTING >&> NUL
else
dir %ARCHIVE /bfOn > %LISTING >&> NUL
endiff
:more
iff %@lines[%LISTING] GE 1 then
set ARCHIVE=%@select[%LISTING,0,0,25,80, Mally's Archive Viewer %VERSION ]
set MORE=more
else
set ARCHIVE=%@line[%LISTING,0]
endiff
if "%ARCHIVE"=="" goto thanks
if "%ARCHIVE"=="**EOF**" goto no_archives
if "%ARCHIVE"=="*.*" goto no_archives
iff "%@ext[%ARCHIVE]"=="arc" then
set ARCHIVER=pkunpak
set VIEW=-v
set POSITION=0
set LENGTH=,13
set EXTRACT=-e
set KEYSTACK=down down down down down down down down
goto main
endiff
iff "%@ext[%ARCHIVE]"=="arj" then
set ARCHIVER=arj
set VIEW=l
set POSITION=0
set LENGTH=,13
set EXTRACT=e
set KEYSTACK=down down down down down down down
goto main
endiff
iff "%@ext[%ARCHIVE]"=="lzh" then
set ARCHIVER=lha
set VIEW=-l
set POSITION=2
set LENGTH=,13
set EXTRACT=e
set KEYSTACK=down down down down down
goto main
endiff
iff "%@ext[%ARCHIVE]"=="zip" then
set ARCHIVER=pkunzip
set VIEW=-v